package indi.utils;

import java.util.Random;

public class ArrayGeneratorUtil {
    private ArrayGeneratorUtil(){}

    public static Integer[] generateOrderedArray(int n){
        Integer[] array = new Integer[n];
        for (int i = 0; i < n; i++){
            array[i] = i;
        }
        return array;
    }

    /**
     * 生成随机数组,值的范围[0,bound)
     * @param n 数组长度
     * @param bound
     * @return
     */
    public static Integer[] generateRandomArray(int n,int bound){
        Random random = new Random();
        Integer[] arr = new Integer[n];
        for (int i = 0; i < n; i++){
            arr[i] = random.nextInt(bound);
        }
        return arr;
    }
}
